{% import 'admin/layout.html' as layout with context -%}
{% import 'admin/static.html' as admin_static with context %}
<!DOCTYPE html>
<html>
<head>
    <title>{% block title %}{% if admin_view.category %}{{ admin_view.category }} - {% endif %}{{ admin_view.name }} -
        {{ admin_view.admin.name }}{% endblock title %}</title>

    {% block head_meta %}
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    {% endblock head_meta %}

    {% block head_css %}
        <!-- Bootstrap 3.3.6 -->
        <link href="{{ url_for('static',filename='css/bootstrap.min.css') }}" rel="stylesheet"/>
        <!-- Font Awesome -->
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"/>
        <!-- Ionicons -->
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css"/>
        <!-- Theme style -->
        <link href="{{ url_for('static',filename='css/AdminLTE.min.css') }}" rel="stylesheet"/>
        <!-- AdminLTE Skins. Choose a skin from the css/skins folder instead of downloading all of them to reduce the load. -->
        <link href="{{ url_for('static',filename='css/skins/_all-skins.min.css') }}" rel="stylesheet"/>
        <!-- iCheck -->
        <link href="{{ url_for('static',filename='plugins/iCheck/flat/blue.css') }}" rel="stylesheet"/>
        <!-- Morris chart -->
        <link href="{{ url_for('static',filename='plugins/morris/morris.css') }}" rel="stylesheet"/>
        <!-- jvectormap -->
        <link href="{{ url_for('static',filename='plugins/jvectormap/jquery-jvectormap-1.2.2.css') }}"
              rel="stylesheet"/>
        <!-- Date Picker -->
        <link href="{{ url_for('static',filename='plugins/datepicker/datepicker3.css') }}" rel="stylesheet"/>
        <!-- Daterange picker -->
        <link href="{{ url_for('static',filename='plugins/daterangepicker/daterangepicker.css') }}" rel="stylesheet"/>
        <!-- bootstrap wysihtml5 - text editor -->
        <link href="{{ url_for('static',filename='plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css') }}"
              rel="stylesheet"/>
        <!-- Flask-admin admin styles -->
        <link href="{{ admin_static.url(filename='admin/css/bootstrap3/admin.css', v='1.1.1') }}" rel="stylesheet">
        {% if admin_view.extra_css %}
            {% for css_url in admin_view.extra_css %}
                <link href="{{ css_url }}" rel="stylesheet">
            {% endfor %}
        {% endif %}
    {% endblock head_css %}

    {% block head %}
    {% endblock head %}

    {% block head_tail %}
    {% endblock head_tail %}

</head>
<body class="hold-transition skin-{{ admin_view.admin.skin }} sidebar-mini">

{% block page_body %}

<div class="wrapper">
    {% if current_user.is_authenticated %}

    <header class="main-header">
        {% block brand %}
        <a href="{{ admin_view.admin.url }}" class="logo">
            <!-- mini logo for sidebar mini 50x50 pixels -->
            <span class="logo-mini">
                            {% autoescape false %}{{ admin_view.admin.short_name }}{% endautoescape %}
                        </span>
            <!-- logo for regular state and mobile devices -->
            <span class="logo-lg">
                            {% autoescape false %}{{ admin_view.admin.long_name }}{% endautoescape %}
                        </span>
        </a>
        {% endblock brand %}

        <nav class="navbar navbar-static-top">
            <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
                <span class="sr-only">Toggle navigation</span>
            </a>
            <div class="navbar-custom-menu">
                <ul class="nav navbar-nav">
                    <li>
                        {% block access_control %}
                            {% if current_user.is_authenticated %}
                                <li class="dropdown user user-menu">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown"
                                       style="padding: 10px 15px;">
                                        <img src="{{ admin_view.admin.gravatar_image_url(current_user.email, "http://adminlte.najdaapps.com/static/img/avatar.png", 30) }}"
                                             style="border-radius: 50%; width: 30px; height:30px;"/>
                                        <span class="hidden-xs"></span>
                                    </a>
                                    <ul class="dropdown-menu">
                                        <li class="user-header">
                                            <img src="{{ admin_view.admin.gravatar_image_url(current_user.email, "http://adminlte.najdaapps.com/static/img/avatar.png", 90) }}"
                                                 style="border-radius: 50%"/>
                                            <p>
                                                {% if current_user.first_name %}
                                                    {{ current_user.first_name }}
                                                    {% if current_user.last_name %}
                                                        {{ current_user.last_name }}
                                                    {% endif %}
                                                    <small>{{ current_user.email }}</small>
                                                {% else %}
                                                    {{ current_user.email }}
                                                {% endif %}
                                            </p>
                                        </li>
                                        <li class="user-footer">
                                            {% if security.changeable %}
                                                <div class="pull-left">
                                                    <a href="{{ url_for('security.change_password') }}"
                                                       class="btn btn-default btn-flat">
                                                        Change Password
                                                    </a>
                                                </div>
                                            {% endif %}
                                            <div class="pull-right">
                                                <a href="{{ url_for('security.logout') }}"
                                                   class="btn btn-default btn-flat">Sign Out</a>
                                            </div>
                                        </li>
                                    </ul>
                                </li>
                            {% endif %}
                        {% endblock %}
                    </li>
                </ul>
                {% block menu_links %}
                    <ul class="nav navbar-nav navbar-right">
                        {{ layout.menu_links() }}
                    </ul>
                {% endblock %}
            </div>
        </nav>
    </header>

    <aside class="main-sidebar">
        <section class="sidebar">
            <ul class="sidebar-menu">
                <li class="header">导航</li>
                {% block main_menu %}
                    {{ layout.menu() }}
                {% endblock %}
            </ul>
        </section>
    </aside>

    <div class="content-wrapper">
        {% endif %}

        {% block messages %}
            <section style="padding: 1px;">
                {{ layout.messages() }}
            </section>
        {% endblock messages %}

        {# store the jinja2 context for form_rules rendering logic #}
        {% set render_ctx = h.resolve_ctx() %}

        {% block body %}
        {% endblock body %}

        {% if current_user.is_authenticated %}
            </div>

            <footer class="main-footer">
                <strong>Copyright &copy; 2020 智者科技</strong>. All rights reserved.
                <div class="pull-right hidden-xs"><b>Version</b> 0.1</div>
            </footer>
        {% endif %}

</div>

{% endblock page_body %}

{% block tail_js %}

    <!-- jQuery 2.2.3 -->
    <script src="{{ url_for('static',filename='plugins/jQuery/jquery-2.2.3.min.js') }}"></script>
    <!-- jQuery UI 1.11.4 -->
    <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
    <!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
    <script>
        $.widget.bridge('uibutton', $.ui.button);
    </script>
    <!-- Bootstrap 3.3.6 -->
    <script src="{{ url_for('static',filename='js/bootstrap.min.js') }}"></script>
    <script src="{{ admin_static.url(filename='vendor/select2/select2.min.js', v='3.5.2') }}"
            type="text/javascript"></script>

    {% if admin_view.extra_js %}
        {% for js_url in admin_view.extra_js %}
            <script src="{{ js_url }}" type="text/javascript"></script>
        {% endfor %}
    {% endif %}

    <!-- Morris.js charts -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
    <script src="{{ url_for('static',filename='plugins/morris/morris.min.js') }}"></script>
    <!-- Sparkline -->
    <script src="{{ url_for('static',filename='plugins/sparkline/jquery.sparkline.min.js') }}"></script>
    <!-- jvectormap -->
    <script src="{{ url_for('static',filename='plugins/jvectormap/jquery-jvectormap-1.2.2.min.js') }}"></script>
    <script src="{{ url_for('static',filename='plugins/jvectormap/jquery-jvectormap-world-mill-en.js') }}"></script>
    <!-- jQuery Knob Chart -->
    <script src="{{ url_for('static',filename='plugins/knob/jquery.knob.js') }}"></script>
    <!-- daterangepicker -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.11.2/moment.min.js"></script>
    <script src="{{ url_for('static',filename='plugins/daterangepicker/daterangepicker.js') }}"></script>
    <!-- datepicker -->
    <script src="{{ url_for('static',filename='plugins/datepicker/bootstrap-datepicker.js') }}"></script>
    <!-- Bootstrap WYSIHTML5 -->
    <script src="{{ url_for('static',filename='plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js') }}"></script>
    <!-- Slimscroll -->
    <script src="{{ url_for('static',filename='plugins/slimScroll/jquery.slimscroll.min.js') }}"></script>
    <!-- FastClick -->
    <script src="{{ url_for('static',filename='plugins/fastclick/fastclick.js') }}"></script>
    <!-- AdminLTE App -->
    <script src="{{ url_for('static',filename='js/app.min.js') }}"></script>
    <!-- AdminLTE for demo purposes -->
    <script src="{{ url_for('static',filename='js/demo.js') }}"></script>
    {% if admin_view.name=="Home" %}
        <script src="{{ url_for('static',filename='js/pages/dashboard.js') }}"></script>
    {% endif %}

{% endblock tail_js %}

{% block tail %}
{% endblock tail %}

</body>
</html>
